package service;

import DAO.EmpDAO;
import DAO.EmpDAOImpl;
import entity.Emp;

import java.util.List;

/**
 * @author lvtian
 * @date 2022/12/20 15:12
 */
public class EmpServiceImpl implements EmpService {
    private EmpDAO dao = new EmpDAOImpl();
    //查询所有员工
    @Override
    public List<Emp> selectEmp() {
        List<Emp> emps = dao.selectEmp();
        return emps;
    }
//添加
    @Override
    public int addEmp(Emp emp) {
        return dao.insertEmp(emp);
    }
//修改
    @Override
    public int updateEmp(Emp emp) {
        return dao.updateEmp(emp);
    }
//删除
    @Override
    public int deleteEmp(int id) {
        return dao.deleteEmp(id);
    }
//通过id查找员工
    @Override
    public List<Emp> selectEmpById(int id) {
        return dao.selectEmpById(id);
    }

    @Override
    public List<Emp> selectEmpByName(String name) {
        return dao.selectEmpByName(name);
    }
}
